package com.xls.resource.dialog;

import android.app.Activity;
import android.view.View;
import android.widget.ImageView;

import com.lzz.bottomencapsulation.entity.VersionEntity;
import com.lzz.bottomencapsulation.popupwindow.CenterBaseDialog;
import com.xls.resource.R;


/***
 @package ${package}
 @filename ${版本升级}
 */
public class APKDownloadDialog extends CenterBaseDialog implements View.OnClickListener {
    VersionEntity versionEntity;//新版本信息
    ImageView dadTvOk;

    /**
     * @param activity
     */
    public APKDownloadDialog(Activity activity) {
        super(activity,true);
        setCanceledOnTouchOutside(false);//设置点击Dialog以外的地方不能让Dialog消失
    }

    public void setVersionEntity(VersionEntity versionEntity) {
        this.versionEntity = versionEntity;
    }

    @Override
    protected int getView() {
        return R.layout.dialog_apk_download;
    }

    @Override
    protected void initView() {
        dadTvOk=findViewById(R.id.dad_close);
        dadTvOk.setOnClickListener(this);
        setCanceledOnTouchOutside(!versionEntity.isForceUpdate());//设置点击Dialog以外的地方不能让Dialog消失
        if (versionEntity.isForceUpdate()) {
            dadTvOk.setVisibility(View.GONE);
        }else {
            dadTvOk.setVisibility(View.VISIBLE);
        }
    }

    @Override
    public void onClick(View v) {
        dismiss();
    }
}
